package com.ljx.api.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ljx.api.entity.User;
import com.ljx.api.mapper.UserMapper;
import com.ljx.api.service.UserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @类名: UserServiceImpl
 * @描述:
 * @日期: 2020-09-07 15:12
 * @作者: 刘纪譞
 * @版本: 1.0.0
 * <p>
 * since JDK 1.8
 **/
@Service
public class UserServiceImpl implements UserService {
    @Resource
    private UserMapper userMapper;
    @Override
    public boolean login(String username, String password) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("username", username);
        queryWrapper.eq("password", password);
        List<User> users = userMapper.selectList(queryWrapper);
        if (users.size() > 0) {
            return true;
        }
        return false;
    }
}
